home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.modula2
- Path: cix.compulink.co.uk!usenet
- From: mark_tbu@cix.compulink.co.uk ("Mark Morgan Lloyd ")
- Subject: Re: constant tables?
- Message-ID: <DoB9py.3s6@cix.compulink.co.uk>
- Organization: KDG Mobrey Telemetry
- References: <erico-1403961506370001@infinitehell.cnmat.berkeley.edu>
- Date: Fri, 15 Mar 1996 13:34:46 GMT
- X-News-Software: Ameol
-
- Please try to keep your lines a bit shorter :-)
-
- > How do I make constant tables?
- >
- > I write code for an embedded system. Lookup tables in ROM are a pretty
- > useful thing and I just couldn't find a way to do it.
-
- Depending on your compiler, you may find the literal data being put in an
- unexpected segment, and then copied to a literal constant. It is
- sometimes easier to put this sort of thing into a fixed location in
- memory, accessed by an absolute variable.
-
- > Did I miss something?
- >
- > Something like
- > [BEGIN EXAMPLE]
- > VAR
- > myTable : ARRAY [0..9] OF CARDINAL = [0, 6, 2, 5, 1, 3, 4, 9, 8, 7];
- > [END EXAMPLE]
-
- Depends very much on the compiler. Under TopSpeed (which we use for
- embedded '386):
-
- TYPE tableType= ARRAY[0..9] OF CARDINAL;
-
- CONST myTable= tableType(0, 6, 2, 5, 1, 3, 4, 9, 8, 7);
-
- Mark Morgan Lloyd
- mark_tbu@cix.compulink.co.uk
-
- [Opinions above are the author's, not those of his employers or
- colleagues]
-